<template>
       <div class="lists_index">
    <!--顶部横条-->
    <Banner></Banner>
    <!--顶部横条-->

    <mainContent :catname="title">
      <div slot="menu_list">
        <dl>
          <dt class="menu_dt" :style="{backgroundImage: 'url(' + menu_bg + ')'}"><span class="iconfont icon-xiangcun"></span>{{title}}</dt>
          <dd class="menu_dd" :class="{'hover':index==active}" v-for="(item,index) in notices" :key="index"
              @click="ToContentPage(item.id,index)">
            {{item.title}}
          </dd>

        </dl>
      </div>
      <div class="inner_content" slot="inner_content" style="height: 655px;">



        <div class="content">
          <!--<div class="left"><img style="width: 100%;height: 100%;object-fit: cover" src="../../assets/images/news/ltdynamic.png"/></div>-->
          <div class="right">

            <NoData v-if="flag"></NoData>

            <div v-for="(item,index) in dynamicList" :key="index" @click="toPath(item.id)" class="dynamic_list">
              <p style="color: black;font-size: 30px">{{item.title}}</p>
              <!--<div class="desc" style="color: #8b8c8b;font-size: 24px;overflow: hidden" v-html="item.content"></div>-->
              <p style="font-size: 28px;color: #a3afb7;text-align: right">{{item.create_at }}</p>
            </div>

          </div>
        </div>

      </div>
    </mainContent>

    <footerBar></footerBar>
    <!--左侧漂浮菜单-->
    <MainMenu></MainMenu>
    <!--左侧漂浮菜单-->
  </div>
</template>

<script>
  import Banner from '../../components/bannder/Banner'
  import MainMenu from '../../components/mainmenu/MainMenu'
  import footerBar from '../../components/content/footerBar'
  import mainContent from '../../components/content/mainContent'
  import NoData from '../../components/nodata/NoData'
    export default {
        name: "CommonList",
      data() {
        return {
          flag:false,
          active: 0,
          notices: [],//公告公示
          richText: "",//富文本数据
          dynamicList: [],//富文本数据
          menu_bg:'',
          title:''

        }
      },
      components: {
        Banner,
        MainMenu,
        footerBar,
        mainContent,
        NoData
      },
      created() {
        console.log('当前路由：', this.$route);
        this.menu_bg=this.$util.storage.get("menu_bg");
        this.title=this.$route.query.name;
        this.type=this.$route.query.type;
        this.active = 0;

        this.getNotices();
      },
      methods: {

        toPath(id) {
          console.log('进入详情页面：', id);
          this.$router.push("/detail?id=" + id+"&name="+this.title);
        },//点击进入详情页面

        toListDetail(id) {
          console.log('您点击了跳转路由事件！,公告公示id：', id);
          this.$router.push({path: '/detail', query: {id: id}});
        },
        ToContentPage(gov_id, index) {
          this.active = index;
          console.log('点击前往不同页面！:', gov_id);
          this.$http.get("/api/WxProgramApi/getGovernDetail?gov_id=" + gov_id, {vollege_id: this.$util.vollege_id}, r => {
            console.log('富文本内容：', r.data.data);
            this.dynamicList = r.data.data;

            if (r.data.data.length==0){
              this.flag=true;
            }else {
              this.flag=false;
            }

          })

        },
        getNotices() {
          console.log('this.$route', this.$route);
          this.$http.get("/api/WxProgramApi/getGovern?type="+this.$route.query.type, {vollege_id:this.$util.vollege_id}, r => {
            console.log('公告公示', r.data);
            // console.log('公告公示', r.data[0].id);
            this.notices = r.data;

            this.$http.get("/api/ScreenkApi/getColumnContent?type="+this.$route.query.type+"&page=1&limit=10000&vollege_id=" + this.$util.vollege_id, null, r => {
              console.log('富文本内容：', r.data.data);
              this.dynamicList = r.data.data;

              if (r.data.data.length==0){
                this.flag=true;
              }else {
                this.flag=false;
              }

            })

          });
        },//获取公告公示

      },
    }
</script>

<style scoped>
  .lists_index {
    width: 100vw;
    height: 1080px;
    /*height: 100%;*/
    /*width: 100%;*/
    background: url("../../assets/images/banner/bg_banner1.jpg") center top no-repeat;
  }

  .son_menu {
    width: 150px;
    height: 54px;
    line-height: 54px;
    margin: 15px auto;
    text-align: center;
    font-size: 18px;
    color: #fff;
    background: url('../../assets/images/page/son_menu.png') no-repeat left center;
    transition: all 0.3s ease-out;
  }

  .son_menu.hover {
    background: url('../../assets/images/page/son_menu_hover.png') no-repeat left center;
  }

  .menu_dd.have {
    transition: all 0.3s ease-in;
  }

  .inner_content {
    /*padding: 60px 50px 0 260px;*/
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    padding-top: 60px;
    padding-left: 20px;
    padding-right: 20px;
    overflow-y: scroll;
  }

  .content {
    height: 100%;
    width: 100%;
    display: flex;
    box-sizing: border-box;
    overflow-y: scroll;
    flex-direction: row;
  }

  .right {
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    padding-left: 10px;
  }

  .dynamic_list {
    margin-bottom: 15px;
    width: 100%;
    height: 120px;
    box-sizing: border-box;
    padding-left: 10px;
    border-bottom: 2px solid #cccccc;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }

</style>
